using System.ComponentModel.DataAnnotations.Schema;

namespace Wips.Domain.Models.Authorities.Model
{
    /// <summary>
    /// 权限与菜单关联
    /// </summary>
    [Table("AuthorityPermissionMenus")]
    [SugarTable("AuthorityPermissionMenus")]
    public class PermissionMenu : ValueObjectBase
    {
        /// <summary>
        /// 权限ID
        /// </summary>
        /// <value></value>
        public string PermissionId { get; set; }

        /// <summary>
        /// 权限
        /// </summary>
        /// <value></value>
        [Navigate(NavigateType.ManyToOne, nameof(PermissionId))]
        public Permission Permission { get; set; }

        /// <summary>
        /// 菜单ID
        /// </summary>
        /// <value></value>
        public string MenuId { get; set; }

        /// <summary>
        /// 菜单组
        /// </summary>
        /// <value></value>
        [Navigate(NavigateType.ManyToOne, nameof(MenuId))]
        public Menu Menu { get; set; }

        public PermissionMenu()
        {
        }

        public PermissionMenu(string permissionId, string menuId)
        {
            PermissionId = permissionId ?? throw new ArgumentNullException(nameof(permissionId));
            MenuId = menuId ?? throw new ArgumentNullException(nameof(menuId));
        }
    }
}